package com.sunny.ynhz.adapter;

import android.app.Activity;
import android.content.Intent;
import android.support.annotation.Nullable;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sunny.ynhz.R;
import com.sunny.ynhz.bean.OfficeAdminBean;

import java.util.List;

/**
 * Created by luao on 2017/8/4.
 */

public class ReportObjectTownAdapter extends BaseQuickAdapter<OfficeAdminBean.DataBean.TownBean, BaseViewHolder> {
    public ReportObjectTownAdapter(@Nullable List<OfficeAdminBean.DataBean.TownBean> data) {
        super(R.layout.item_report_obj, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, final OfficeAdminBean.DataBean.TownBean item) {
        helper.setText(R.id.report_obj, item.getName());
        helper.itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent();
                intent.putExtra("reportObj", item.getName());
                intent.putExtra("officeAdmin", item.getOfficeAdmin());
                ((Activity) mContext).setResult(300, intent);
                ((Activity) mContext).finish();
            }
        });
    }
}
